// pages/index/phone.js

Page({

  data: {
    type:0,phone:'',
  },

  onLoad: function (options) {
   
     this.setData({re})
  },

  change(e){
    let reg=/^1[3|4|5|8][0-9]\d{4,8}$/
    let re=new RegExp(reg)
    console.log(e);
    if(re.test(e.detail.value)&&e.detail.value.length==11){
     
     this.setData({
       type:1,
       phone:e.detail.value
     })}else{
    this.setData({type:0})}
    
  },
  //获取验证码
  getrecoginize(){
    
      wx.request({
        url: 'https://zujieba.com/Api/phone/code.html',
        data:{phone:this.data.phone},
        method:'POST',
        success:(res)=>{
          console.log(res);
          if(res.data.success==1){
            wx.setStorageSync('yanzhengma2', res.data.data)
            
            
            wx.navigateTo({
              url: '../../mine/code/code?phone='+this.data.phone,
            })
          }else{
            wx.showToast({
              title: res.data.tips,
            })
          }
         
          
        }
      })
      
       
  }
})